<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Installing on Linux</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="kvaser.gif"/></td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('section_install_linux.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">Installing on Linux </div>  </div>
</div><!--header-->
<div class="contents">
<div class="toc"><h3>Table of Contents</h3>
<ul><li class="level1"><a href="#section_install_driver_linux">Installing the Driver</a><ul><li class="level2"><a href="#section_install_virtual_device_linux">Installing Virtual Devices</a></li>
<li class="level2"><a href="#section_uninstall_driver_linux">Removing the driver</a></li>
</ul>
</li>
<li class="level1"><a href="#section_install_sdk_linux">Installing Kvaser CANlib SDK</a><ul><li class="level2"><a href="#section_uninstall_sdk_linux">Removing Kvaser CANlib SDK</a></li>
</ul>
</li>
</ul>
</div>
<div class="textblock"><p>We recommend that you install the drivers first, then the Kvaser CANlibSDK, and last install the hardware.</p>
<p>The latest versions of documentation, software and drivers can be downloaded for free at <a href="https://www.kvaser.com/download/">www.kvaser.com/download</a>.</p>
<h1><a class="anchor" id="section_install_driver_linux"></a>
Installing the Driver</h1>
<p>System requirements:</p><ul>
<li>Linux 2.6.29 or later</li>
<li>Header files and compiler for kernel compilation.</li>
</ul>
<p>In Ubuntu e.g. installing header files is accomplished by issuing the command:</p>
<div class="fragment"><div class="line">sudo apt-get install build-essential </div></div><!-- fragment --><p>On some systems you may need to install the Linux headers using something like:</p>
<div class="fragment"><div class="line">sudo apt-get install linux-headers-`uname -r` </div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>Having versions of the Linux headers installed other than that of the currently running kernel may cause conflicts and faulty drivers.</dd></dl>
<p>To download and unpack the latest drivers you may use: </p><div class="fragment"><div class="line">wget --content-disposition <span class="stringliteral">&quot;https://www.kvaser.com/downloads-kvaser/?utm_source=software&amp;utm_ean=7330130980754&amp;utm_status=latest&quot;</span></div><div class="line">tar xvzf linuxcan.tar.gz</div><div class="line">cd linuxcan</div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>Choose a path that doesn't contain any spaces for CANlib to build properly.</dd></dl>
<p>To build (compile) all drivers use:</p>
<div class="fragment"><div class="line">make </div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>It is advised to remove the old driver by calling <code>sudo make uninstall</code> before replacing the installed drivers.</dd></dl>
<p>To install all drivers use:</p>
<div class="fragment"><div class="line">sudo make install </div></div><!-- fragment --><p>To install and load, virtual and PCI drivers: </p><div class="fragment"><div class="line">sudo make load </div></div><!-- fragment --><dl class="section note"><dt>Note</dt><dd>Running <code>sudo make load</code> will also cause the virtual and PCI drivers to be loaded at boot time. This might be bad if experimenting with the device drivers.</dd>
<dd>
It is never required to manually install or load any modules, create or edit files. This is taken care of the Makefile, in the root of the linuxcan directory.</dd></dl>
<p>More information can be found in the included README file.</p>
<h2><a class="anchor" id="section_install_virtual_device_linux"></a>
Installing Virtual Devices</h2>
<p>The driver named "virtualcan" controls the Virtual Devices. The number of channels each Virtual Device has, and the total number of Virtual Devices, is controlled by editing define statements in linuxcan\virtualcan\virtualcan.h.</p>
<div class="fragment"><div class="line"><span class="preprocessor">#define NR_CHANNELS          2</span></div><div class="line"></div><div class="line"><span class="preprocessor">#define NR_VIRTUAL_DEV       1</span></div></div><!-- fragment --><h2><a class="anchor" id="section_uninstall_driver_linux"></a>
Removing the driver</h2>
<p>To unload and uninstall all drivers: </p><div class="fragment"><div class="line">sudo make uninstall </div></div><!-- fragment --><p>Alternatively, if there are multiple versions of the drivers installed, all of them can be removed using: </p><div class="fragment"><div class="line">sudo make purge </div></div><!-- fragment --><h1><a class="anchor" id="section_install_sdk_linux"></a>
Installing Kvaser CANlib SDK</h1>
<p>System requirements:</p><ul>
<li>The package libxml2-dev is needed in order to build kvamemolibxml.</li>
<li>The packages libssl-dev and zlib1g-dev are needed to build kvlclib.</li>
</ul>
<p>To download and unpack the latest version of Linux SDK library use: </p><div class="fragment"><div class="line">wget --content-disposition <span class="stringliteral">&quot;https://www.kvaser.com/downloads-kvaser/?utm_source=software&amp;utm_ean=7330130981966&amp;utm_status=latest&quot;</span></div><div class="line">tar xvzf kvlibsdk.tar.gz</div><div class="line">cd kvlibsdk</div></div><!-- fragment --><p>To build everything, run</p>
<div class="fragment"><div class="line">make </div></div><!-- fragment --><p>To run self-tests, run</p>
<div class="fragment"><div class="line">make check </div></div><!-- fragment --><p>To install everything, run</p>
<div class="fragment"><div class="line">sudo make install </div></div><!-- fragment --><h2><a class="anchor" id="section_uninstall_sdk_linux"></a>
Removing Kvaser CANlib SDK</h2>
<p>To uninstall everything, run</p>
<div class="fragment"><div class="line">sudo make uninstall </div></div><!-- fragment --> </div></div><!-- contents -->
</div><!-- doc-content -->
<!-- HTML footer for doxygen 1.8.13-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="page_installing.html">Installation</a></li>
    <li class="footer"> (canlib 5.38) Tue Feb 15 2022</li>
  </ul>
</div>
</body>
</html>
